#ifndef __EEPROM_H__
#define __EEPROM_H__ 
//W25Q128
#include "ti_msp_dl_config.h"
#include "PID.h"
#include "my_uart.h"


// EEPROM片选控制宏
#define SPI_CS(x)  ( (x) ? DL_GPIO_setPins(SPI1_CS_PORT, SPI1_CS_EEPROM_CS_PIN) : DL_GPIO_clearPins(SPI1_CS_PORT, SPI1_CS_EEPROM_CS_PIN) )



#define YAW_KP_ADDR 0xC000
#define YAW_KI_ADDR 0x1000
#define YAW_KD_ADDR 0x3000

#define GRAY_KP_ADDR 0x4000
#define GRAY_KI_ADDR 0x5000
#define GRAY_KD_ADDR 0x6000

#define SERVO_KP_ADDR 0x7000
#define SERVO_KI_ADDR 0x8000
#define SERVO_KD_ADDR 0x9000

extern float PID_data_array[3][3];
uint16_t W25Q128_readID(void);// 读取W25Q128的ID
void W25Q128_write(uint8_t* buffer, uint32_t addr, uint16_t numbyte);      // W25Q128写数据
void W25Q128_read(uint8_t* buffer,uint32_t read_addr,uint16_t read_length);// W25Q128读数据
float EEPROM_ReadFloat(uint32_t addr);
void EEPROM_Init(void);
void EEPROM_Save(void);
void W25QXX_first_Init(void);
void test_eeprom_rw(void);

#endif

